<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
  <body>
    <div id="app">
      <ul>
        <item v-for="(item,index) in student" :key="index"></item>
        <!-- <item v-for="(item,index) in list" :key="item.id"></item> -->
      </ul>
      <button @click="change">change</button>
    </div>
    <script>
      new Vue({
        el: "#app",
        data() {
          return {
            list: [
              {
                id: 0,
                num: 1,
              },
              {
                id: 1,
                num: 2,
              },
              {
                id: 2,
                num: 3,
              },
            ],
            student: [1, 2, 3, 4],
          };
        },
        methods: {
          //删除数据
          change() {
            this.student.splice(0, 1);
            // this.list.splice(0, 1)
          },
        },
        components: {
          item: {
            template: `<div>{{Math.random()}}</div>`,
          },
        },
      });
    </script>
  </body>
</html>
